1. Field of the Invention
The present invention relates to a program rewriting apparatus built-in an electronic machinery, in particular to a program rewriting apparatus for rewriting a program for controlling the operation of the electronic machinery.
2. Related Background Art
The program for controlling the operation of the electronic machinery is normally stored in MASKROM, EPROM, EEPROM, flash memory or the like provided in the electronic machinery. These memories are used for only read. With the EPROM, EEPROM, flash memory or the like, however, a program stored in the memory can be rewritten electrically by using a special device. CPU (Central Processor Unit) provided in the electronic machinery controls individual sections inside the electronic machinery in accordance with a program stored in the above memory.
Recently in electronic machineries such as a peripheral equipment (scanner, printer, modem or the like) or mother board of a PC (Personal Computer), the need for rewriting a program stored in the above memory arises in order to add a function to the electronic machinery or amend the fault occurring in the electronic machinery. In such cases, the following two methods are used to omit the labor of replacing the above memory inside electronic machinery with the memory storing an updated program.
(1) An electrically rewritable memory such as EEPROM or flash memory is used as the memory for storing the program. When a program stored in a memory is to be rewritten, the electronic machinery downloads a modified program from the PC. Then, the electronic machinery executes the rewrite of a program in itself. In this manner, the addition of a function or the amendment of a fault in the electronic machinery is realized. PA1 (2) Only the boot part of a program (initializing part for communication or the like) is stored in the MASKROM or EPROM. At the time of turning on power of the electronic machinery, only the communication function between the PC and the electronic machinery becomes operable. Every time starting the driver software of the above electronic machinery on the PC side, a program for controlling the electronic equipment is downloaded onto RAM in the electronic machinery by the communication function. And in accordance with the program downloaded onto the RAM, a CPU of the electronic machinery controls individual sections inside the electronic machinery. In the case of adding a function or amending a fault of the electronic machinery, an up-to-date driver software is set in the PC. Thus, the electronic machinery can store an updated program for controlling itself in the RAM. Namely, it is not necessary to change the memory of the electronic machinery that stores the program. In this way, the addition of a function or amendment of a fault in the electronic machinery is realized.
An undated program for adding a function or amending a fault in both methods mentioned above, is distributed to users via a communication line from a PC communication or from a home page in the internet. Accordingly, a user is not required to resend electronic machinery to its maker or to take it to the service window. Furthermore, the person in charge at the maker need not decompose the electronic machinery to exchange the memory.
The prior arts mentioned above have the following problems:
First, in case of the above method (1), the power supply can run down so that and the write of a program can fail in the course of writing a program into the EEPROM or flash memory. Furthermore, the writing into the EEPROM or flash memory can fail for some causes. In this case, the program whose rewrite proceeds to midway cannot be matched between the pre-rewrite and the post-rewrite portions as a whole program. Consequently, the program ends in runaway and cannot operate normally.
The electronic machinery falling into the above status disables a program to be rewritten by a user. Accordingly, the user must resend the electronic machinery to the maker or take the electronic machinery to the service window. And, a person of the maker in charge must decompose the electronic machinery to exchange the memory.
Secondly, in case of the above method (2), a program of the boot portion, written in the MASKROM or EPROM, cannot be rewritten by the download from a PC. Thus, if the addition of a function or the amendment of a fault is required in a program of the boot portion, the user must resend the electronic machinery to the maker or take the electronic machinery to the service window. And, a person of the maker in charge must decompose the electronic machinery to exchange the memory.